//
//  ViewController.m
//  笔试
//
//  Created by dengbb on 16/3/1.
//  Copyright © 2016年 mohekeji. All rights reserved.
//

#import "ViewController.h"
#import "MemoryViewController.h"

@interface ViewController ()

@end

@implementation ViewController


// static特性 全局性
static NSString * name = @"xiaoLi";
// const 修饰常量
static const int age = 15;

- (void)viewDidLoad {
    [super viewDidLoad];

    NSLog(@"第一次：%@",name);
    NSLog(@"第一次：%d",age);
    name = @"xiaoZhao";
//    age = 10;
    NSLog(@"第二次：%@",name);
    NSLog(@"第二次：%d",age);
    
    // Do any additional setup after loading the view, typically from a nib.
    UIButton *b = [[UIButton alloc] initWithFrame:CGRectMake(100, 100, 50, 50)];
    [b addTarget:self action:@selector(jump) forControlEvents:UIControlEventTouchUpInside];
    b.backgroundColor = UIColor.blueColor;
    [self.view addSubview:b];
    
}
-(void)jump{
    
    [self.navigationController pushViewController:[[MemoryViewController alloc]init] animated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    /*
     如果.m文件和方法体里面定义了同名的static 变量，那么方法体里面的实例变量和全局的static变量不会冲突，在方法体内部访问的static变量和全局的static变量是不同的。
     */
    NSString *name = @"xiaoSun";
    NSLog(@"%@",name);
    
}
@end
